package kit.edu.lego.gruppe3.levels.sumpf;

import kit.edu.lego.gruppe3.ComponentsRepository;
import kit.edu.lego.gruppe3.levels.LevelSelector;
import lejos.nxt.TouchSensor;
import lejos.robotics.navigation.DifferentialPilot;
import lejos.robotics.subsumption.Behavior;

public class LeftWallHit implements Behavior{
	
	private TouchSensor leftTouch = ComponentsRepository.getInstance().getLeftTouchSensor();
	private TouchSensor rightTouch = ComponentsRepository.getInstance().getRightTouchSensor();
	private DifferentialPilot robot = ComponentsRepository.getInstance().getRobotPilot();
	
	@Override
	public void action() {
		robot.rotate(-45);
	}

	@Override
	public void suppress() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean takeControl() {
		return LevelSelector.getInstance().isSumpf() &&
			(leftTouch.isPressed() || rightTouch.isPressed());
	}

}
